Home-page: http://www.python-excel.org

Python package "xlrd"

Purpose: Provide a library for developers to use to extract data from Microsoft Excel (tm) spreadsheet files. It is not an end-user tool.

Author: John Machin, Lingfo Pty Ltd (sjmachin@lexicon.net)

Licence: BSD-style (see licences.py)

Version of xlrd: 0.7.1 -- 2009-05-31

Versions of Python supported: 2.6-2.7.

External modules required:

The package itself is pure Python with no dependencies on modules or packages outside the standard Python distribution.

Versions of Excel supported: 2004, 2003, XP, 2000, 97, 95, 5.0, 4.0, 3.0, 2.1, 2.0. Support for Excel 2007 .xlsx files scheduled for version 0.7.1.

Outside the current scope: xlrd will safely and reliably ignore any of these if present in the file:

Unlikely to be done:

Particular emphasis (refer docs for details):

Quick start:

    import xlrd
    book = xlrd.open_workbook("myfile.xls")
    print "The number of worksheets is", book.nsheets
    print "Worksheet name(s):", book.sheet_names()
    sh = book.sheet_by_index(0)
    print sh.name, sh.nrows, sh.ncols
    print "Cell D30 is", sh.cell_value(rowx=29, colx=3)
    for rx in range(sh.nrows):
        print sh.row(rx)
    # Refer to docs for more details.
    # Feedback on API is welcomed.

Another quick start: This will show the first, second and last rows of each sheet in each file:

    OS-prompt>python PYDIR/scripts/runxlrd.py 3rows *blah*.xls

Installation:

Download URLs:

Acknowledgements: